package com.oig.sys.base.service.impl;


import com.oig.sys.base.dao.ITbHsTariffExgDao;
import com.oig.sys.base.entity.TbHsTariffExg;
import com.oig.sys.base.service.ITbHsTariffExgService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
@RequiredArgsConstructor
public class TbHsTariffExgServiceImpl implements ITbHsTariffExgService {

    private final ITbHsTariffExgDao hsTariffExgDao;


    @Override
    public List<TbHsTariffExg> findHsTariffExgList(String hsCode, String agreementCode) {
        if (StringUtils.isNotBlank(hsCode) && hsCode.length()>8){
            hsCode = hsCode.substring(0, 8);
            log.debug("hscode处理，查询排除商品：hsCode:{}-agreementCode:{}",hsCode,agreementCode);
        }
        return this.hsTariffExgDao.findByHsCodeAndAgreementCode(hsCode, agreementCode);
    }


}
